package com.chrray.position.enums.app;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 报酬单位：
 *  计价时: 1-小时,2-天,3-月||计件时: 11-次 12-个 13-平方 14-米 15-套 16-车 17-根
 */
public enum FdSalaryUnitEnum implements BaseEnum{
    HOUR(1, "小时"),
    DAY(2, "天"),
    MONTH(3, "月")

    // 计件时
    ,TIMES(11, "次")
    ,PIECE(12, "个")
    ,SQUARE(13, "平方")
    ,METER(14, "米")
    ,SET(15, "套")
    ,CAR(16, "车")
    ,ROOT(17, "根")
    ;

    @JsonValue
    @EnumValue
    private final Integer value;
    private final String info;

    FdSalaryUnitEnum(Integer value, String info) {
        this.info = info;
        this.value = value;
    }

    @JsonCreator
    public static FdSalaryUnitEnum getByValue(Integer value) {
        for (FdSalaryUnitEnum en : FdSalaryUnitEnum.values()) {
            if (en.getValue().equals(value)) {
                return en;
            }
        }
        return null;
    }

    public Integer getValue() {
        return value;
    }

    public String getInfo() {
        return info;
    }
}
